<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<title>Developer Console</title>
</head>
<link rel="stylesheet" href="../../resources/css/main.css"
	type="text/css">
<script src="../../script/base.js"></script>
<script src="../../script/control.js"></script>
<script language="JavaScript">
  var contextPath = "<c:out value='${pageContext.request.contextPath}'/>";
</script>
<body>
<f:view>
	<f:loadBundle basename="net.orange.conf.lang.fw" var="msg" />
	<h:form id="myForm">
		<h:panelGrid columns="2" rowClasses="content-title"
			style="width:100%;">
			<h:outputText value="#{msg.console_title_2}." />

			<h:panelGroup style="text-align:right">
				<h:commandButton value="#{msg.console_execute}" type="submit" id="cmdExecute"
					action="#{jdbc.execute}" styleClass="button-normal" />

				<h:outputLabel value="    " />

				<h:commandButton value="#{msg.console_export}" type="submit" id="cmdExport"
					action="#{jdbc.export}" styleClass="button-normal" />

				<h:outputLabel value="    " />

				<h:commandButton value="#{msg.console_analyze}" type="submit" id="cmdAnalyze"
					action="#{jdbc.analyze}" styleClass="button-normal" />
			</h:panelGroup>
		</h:panelGrid>

		<h:messages styleClass="content-message" />

		<h:panelGrid rowClasses="content-detail-title,content-detail"
			style="width:100%" columns="2"
			columnClasses="content-detail-title,content-detail">
			<h:outputLabel value="#{msg.console_jdbc}:" />
			<h:inputText value="#{jdbc.jdbcDriver}" id="jdbcDriver" />

			<h:outputLabel value="#{msg.console_dburl}:" />
			<h:inputText value="#{jdbc.databaseURL}" id="databaseURL" />

			<h:outputLabel value="#{msg.console_user_name}:" />
			<h:inputText value="#{jdbc.userName}" id="userName" />

			<h:outputLabel value="#{msg.console_user_pwd}:" />
			<h:inputText value="#{jdbc.passWord}" id="passWord" />

		</h:panelGrid>

		<h:panelGrid rowClasses="content-detail-title" style="width:100%">
			<h:outputLabel value="#{msg.console_query}:" />
			<h:inputTextarea value="#{jdbc.sql}" id="script" rows="6" />
			<h:outputLabel value="#{jdbc.datas.metaDataSet.values}" />
		</h:panelGrid>

		<table width="100%">
			<tr class="content-detail-title">
				<c:forEach var="the"
					items="${sessionScope.jdbc.datas.metaDataSetIterator}">
					<td nowrap><c:out value="${the.columnName}" /></td>
				</c:forEach>
			</tr>

			<c:forEach var="the" items="${sessionScope.jdbc.datas.rows}">
				<tr class="content-detail">
					<c:forEach var="data" items="${the.datas}">
						<td nowrap><c:out value="${data.stringValue}" /></td>
					</c:forEach>
				</tr>
			</c:forEach>
		</table>
	</h:form>
</f:view>
</body>
</html>
